﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
/// <summary>
/// Summary description for clsResumeSkillsDAL
/// </summary>
public class clsResumeSkillsDAL
{
    InstantNaukriDataContextDataContext objInstantNaukriDataContextDataContext = new InstantNaukriDataContextDataContext();
    public clsResumeSkillsDAL()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public List<IN_TB_RRESUME_SKILL> GetAllResumeSkills()
    {
        try
        {
            List<IN_TB_RRESUME_SKILL> objIN_TB_RRESUME_SKILL = new List<IN_TB_RRESUME_SKILL>();
            objIN_TB_RRESUME_SKILL = (from obj in objInstantNaukriDataContextDataContext.IN_TB_RRESUME_SKILLs
                                      select obj).ToList();
            return objIN_TB_RRESUME_SKILL;
        }
        catch (Exception)
        {

            throw;
        }
    }

    public IN_TB_RRESUME_SKILL GetResumeSkillsById(int ID)
    {
        try
        {
            IN_TB_RRESUME_SKILL objIN_TB_RRESUME_SKILL = new IN_TB_RRESUME_SKILL();
            objIN_TB_RRESUME_SKILL = (from obj in objInstantNaukriDataContextDataContext.IN_TB_RRESUME_SKILLs
                                      where obj.ID == ID
                                      select obj).SingleOrDefault();
            return objIN_TB_RRESUME_SKILL;
        }
        catch (Exception)
        {

            throw;
        }
    }

    public List<IN_TB_RRESUME_SKILL> GetResumeSkillsByUserId(int UserId)
    {
        try
        {
            List<IN_TB_RRESUME_SKILL> objIN_TB_RRESUME_SKILL = new List<IN_TB_RRESUME_SKILL>();
            objIN_TB_RRESUME_SKILL = (from obj in objInstantNaukriDataContextDataContext.IN_TB_RRESUME_SKILLs
                                      where obj.USERID == UserId
                                      select obj).ToList();
            return objIN_TB_RRESUME_SKILL;
        }
        catch (Exception)
        {

            throw;
        }
    }

    public int SaveResumeSkills(IN_TB_RRESUME_SKILL objIN_TB_RRESUME_SKILL)
    {
        try
        {
            IN_TB_RRESUME_SKILL objIN_TB_RRESUME_SKILLD = new IN_TB_RRESUME_SKILL();
            objIN_TB_RRESUME_SKILLD = (from obj in objInstantNaukriDataContextDataContext.IN_TB_RRESUME_SKILLs
                                       where obj.ID == objIN_TB_RRESUME_SKILL.ID
                                       select obj).SingleOrDefault();
            if (objIN_TB_RRESUME_SKILLD != null)
            {
                objIN_TB_RRESUME_SKILLD.ID = objIN_TB_RRESUME_SKILL.ID;
                objIN_TB_RRESUME_SKILLD.USERID = objIN_TB_RRESUME_SKILL.USERID;
                objIN_TB_RRESUME_SKILLD.TECHNOLOGY = objIN_TB_RRESUME_SKILL.TECHNOLOGY;
                objIN_TB_RRESUME_SKILLD.LAST_USED = objIN_TB_RRESUME_SKILL.LAST_USED;
                objIN_TB_RRESUME_SKILLD.EXPERIENCE = objIN_TB_RRESUME_SKILL.EXPERIENCE;
                objIN_TB_RRESUME_SKILLD.CREATED_BY = objIN_TB_RRESUME_SKILL.CREATED_BY;
                objIN_TB_RRESUME_SKILLD.CREATED_ON = objIN_TB_RRESUME_SKILL.CREATED_ON;
                objIN_TB_RRESUME_SKILLD.MODIFIED_BY = objIN_TB_RRESUME_SKILL.MODIFIED_BY;
                objIN_TB_RRESUME_SKILLD.MODIFIED_ON = objIN_TB_RRESUME_SKILL.MODIFIED_ON;
                objInstantNaukriDataContextDataContext.SubmitChanges();
                return objIN_TB_RRESUME_SKILLD.ID;
            }
            else
            {
                objInstantNaukriDataContextDataContext.IN_TB_RRESUME_SKILLs.InsertOnSubmit(objIN_TB_RRESUME_SKILL);
                objInstantNaukriDataContextDataContext.SubmitChanges();
                return objIN_TB_RRESUME_SKILL.ID;
            }
        }
        catch (Exception)
        {

            throw;
        }
    }
}
